package com.lqm.service.home.impl;

import com.lqm.dao.ProjectTypeDao;
import com.lqm.entity.home.ProjectType;
import com.lqm.service.home.ProjectTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @program: CrowdFunding
 * @description
 * @author: lqm
 * @create: 2018-12-17 16:20
 */
@Service
@Transactional
public class ProjectTypeServiceImpl implements ProjectTypeService {

    @Autowired
    ProjectTypeDao projectTypeDao;


    /**
     * 获取所有的项目分类栏目名称
     * @param status 1:正常使用 、0：禁用
     * @return
     */
    @Override
    public List<ProjectType> getAllProjectTypeByStatus(Integer status) {

        return this.projectTypeDao.findAllByStatus(status);
    }

    @Override
    public List<ProjectType> getAllProjectType() {
        return projectTypeDao.findAll();
    }

    @Override
    @Transactional
    public void setProjectTypeStatus(ProjectType projectType,int status) {
        ProjectType one = projectTypeDao.getOne(projectType.getTypeId());
        one.setStatus(status);
    }
}
